package cn.codesugar.advance

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import cn.codesugar.advance.model.Animal
import cn.codesugar.advance.model.Fruit
import cn.codesugar.advance.model.Person

class FirstActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_first)
        Handler(Looper.getMainLooper()).postDelayed({
            val person = Person("Tony", 24)
            val apple = Fruit("Apple", 250)
            val dog = Animal("Dog", 3)
            val intent = Intent(this, SecondActivity::class.java)
            intent.putExtra("string_data", "hello")
            intent.putExtra("int_data", 100)
            intent.putExtra("person_data", person)
            intent.putExtra("fruit_data", apple)
            intent.putExtra("animal_data", dog)
            startActivity(intent)
        }, 3000L)
    }
}